package com.cy.pj.activity.controller;

import com.cy.pj.activity.pojo.Activity;
import com.cy.pj.activity.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class ActivityController {
    @Autowired
    private ActivityService activityService;

    @RequestMapping("/activity/doActivityUI")
    public String doActivityUI(){
        return "activity";
    }
    @RequestMapping("/activity/doFindActivitys")
    @ResponseBody
    public List<Activity> doFindActivitys() {
        List<Activity>  list=activityService.findActivitys();
        return list;
    }
    @RequestMapping("/activity/doSaveActivity")
    @ResponseBody
    public String doSaveActivity(Activity activity) {
        activityService.saveActivity(activity);
        return "save ok";
    }
}
